#ifndef __epwm_85k_h
#define __epwm_85k_h

// Included Files
//
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include "user.h"

#define TBPRD_MIN_VAL   0
#define TBPRD_MAX_VAL   1000


//
// EPWM3B - GPIO Settings
//


typedef struct
{
    uint32_t base;
    uint16_t epwmTimerTbprd;
    uint16_t cmpa_val;
    uint16_t cmpb_val;
    uint16_t getDutyCyclePerc;
    uint16_t setDutyCyclePerc;
    int16_t phase;
} EPWMINFO_T;


void USER_InitEPWM(void);

void initEPWMWithoutDB(uint16_t base,uint16_t EPWM_TIMER_TBPRD,EPWMINFO_T* epwmInfo);
EPWMINFO_T* getEpwmInfo(int base) ;

__interrupt void epwm1ISR(void);

__interrupt void epwm2ISR(void);

__interrupt void epwm3ISR(void);

__interrupt void epwm4ISR(void);


__interrupt void epwm1TZISR(void);
__interrupt void epwm2TZISR(void);
__interrupt void epwm3TZISR(void);

void USER_setEPWMPhasePerc(uint32_t base,int16_t PhasePerc);
void USER_setEPWMPhase(uint32_t base,int16_t Phase);
void updateCompare(EPWMINFO_T *epwmInfo);

void setEpwmDutyCycle(uint16_t base,uint16_t dutyCyclePerc);
void epwm_checkPinToOpenEpwm(uint32_t pin,uint16_t base);

void setupEPWMOutputSwap(uint16_t base);

void setupEPWMActiveHigh(uint16_t base);

void setupEPWMActiveLowComplementary(uint16_t base);

void setupEPWMActiveHighComplementaryAntiPhase(uint16_t base);

void setupEPWMActiveHighComplementary(uint16_t base);
void setupEPWMActiveLow(uint16_t base);
void USER_setEpwmTBPRD(uint16_t base,uint16_t tbprd_val);
uint16_t USER_readEpwmTBPRD(uint16_t base);
#endif
